<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>{:config('version_name')} {:config('version_num')} - {:config('app_name')}</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
	<link href="{$public}layui/css/layui.css{$version}" rel="stylesheet" media="all">
    <link href="{$source}css/admin.css{$version}" rel="stylesheet" media="all">
    <!-- <link href="{$source}css/style.css{$version}" rel="stylesheet" media="all"> -->
	<script src="{$public}layui/layui.js{$version}"></script>
    <script>
		/*
        layui.config({
            base: '{$source}js/',
            version: '{$layui_version}',
        }).use('global');
		*/
    </script>
</head>
<body>
<div class="layui-layout layui-layout-admin">
	<div class="layui-header">
		<div class="fl header-logo">管理控制台</div>
		<ul class="layui-nav fl nobg main-nav">
		{volist name="menu_tree" id="vo" key="k"}
			<li class="layui-nav-item {eq name='k' value='1'} layui-this {/eq}">
				<a href="javascript:;" title="{$vo.tips}">{$vo.title}</a>
			</li>
		{/volist}
		</ul>
		
		<ul class="layui-nav fr nobg">
			<li class="layui-nav-item">
				<a href="{:url('/')}" target="_blank">前台</a>
			</li>
			<li class="layui-nav-item">
				<a href="javascript:;" class="wy_but" wy-event="lay_ajax" wy-url=="{:url('Index/clear_cache')}">清缓存</a>
			</li>
			<li class="layui-nav-item">
				<a href="javascript:;">系统管理员：[Admin]&nbsp;&nbsp;</a>
				<dl class="layui-nav-child">
					<dd><a href="javascript:;" class="wy_but" wy-event="lay_tab" wy-url="{:url('Index/personal')}">基本资料</a></dd>
					<dd><a href="javascript:;" class="wy_but" wy-event="lay_tab" wy-url="{:url('Index/password')}">修改密码</a></dd>
					<dd><a href="javascript:;" class="wy_but" wy-event="lay_ajax" wy-url="{:url('Index/unlogin')}">退出登录</a></dd>
				</dl>
			</li>
		</ul>
	</div>
	
	
	<div class="layui-side layui-bg-black" id="switchNav">
		<div class="layui-side-scroll">
		{volist name="menu_tree" id="vo" key="k"}
			<ul class="layui-nav layui-nav-tree" {neq name='k' value='1'}  style="display:none;" {/neq} >
				{volist name="vo['son_lists']" id="vv" key="kk"}
				<li class="layui-nav-item  {eq name='kk' value='1'} layui-nav-itemed {/eq}  ">
					{if isset($vv['son_lists'])}
						<a href="javascript:;"><i class="{$vv.icon}"></i> {$vv.title}<span class="layui-nav-more"></span></a>
						<dl class="layui-nav-child">
							{volist name="vv['son_lists']" id="vvv" key="kkk"}
								<dd {if $vvv.id == 111} class="layui-this"{/if}><a class="admin-nav-item" data-id="{$vvv.id}" href="{:wy_url($vvv['url'])}"><i class="{$vvv.icon}"></i> {$vvv.title}</a></dd>
							{/volist}
						</dl>
					
					{else/}
						<a data-id="{$vvv.id}" href="{:wy_url($vv['url'])}"><i class="{$vv.icon}"></i> {$vv.title}</a>
					{/if}
				</li>
				{/volist}
			</ul>
		{/volist}
		
		</div>
	</div>
	<div class="layui-body" id="switchBody">
	
		<div class="layui-tab layui-tab-card" lay-filter="WyTab" lay-allowClose="true" style="margin:0;">
			<ul class="layui-tab-title" id="tab-card-nav">
				<li lay-id="111" class="layui-this"><i class="layui-icon layui-icon-refresh" lay-id="111"></i>系统主页</li>
			</ul>
			<div class="layui-tab-content">
				<div class="layui-tab-item layui-show">
					<iframe id="tree_id_111" width="100%" height="100%" lay-id="111" frameborder="0" src="{:url('Dist/index')}" scrolling="yes" class="hs-iframe"></iframe>
				</div>
			</div>
		</div>
		
	</div>
	<div class="layui-footer footer">
		<span class="fl">Powered by <a href="{:config('version_url')}" target="_blank">{:config('version_name')}</a> {:config('version_num')}</span>
		<span class="fr"> © 2006-{:date('Y')+1} <a href="{:config('version_url')}" target="_blank">{:config('version_title')}</a> All Rights Reserved.</span>
	</div>
</div>
<div style="width:0;height:0;overflow:hidden"></div>
<style>
#tab-card-nav .layui-icon-refresh{
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 20px;
    margin-right: 8px;
    top: 1px;
    text-align: center;
    font-size: 14px;
    color: #c2c2c2;
    transition: all .2s;
    -webkit-transition: all .2s;
}
#tab-card-nav .layui-icon-refresh:hover {
    border-radius: 2px;
    background-color: #FF5722;
    color: #fff;
}
</style>
<script type="text/javascript">
layui.use(['jquery', 'element', 'layer'],function(){
	var $ = layui.jquery,
		element = layui.element,
		layer = layui.layer;
	
	// 设置内容iframe 的高
	$('.layui-tab-content').css({"padding":"0","overflow":"hidden","height":($(window).height() - 145 - 2)});
	// 刷新tab
	$(document).on("click","#switchBody .layui-icon-refresh",function(){
		var _this = $(this);
		var _id = _this.attr("lay-id");
		var _this_ifram = $("#switchBody .layui-tab-content .layui-tab-item iframe#tree_id_"+_id);
		_this_ifram.attr("src",_this_ifram.attr("src"));
	});
	$('.main-nav a').click(function () {
		var that = $(this), i = $('.main-nav a').index(this);
		$('.layui-nav-tree').hide().eq(i).show();
    });
	var tab = {
		add: function(title, url, id){
			element.tabAdd('WyTab', {
				title: '<i class="layui-icon layui-icon-refresh" lay-id="'+id+'"></i>'+title,
				content: '<iframe id="tree_id_'+id+'" width="100%" height="100%" lay-id="'+id+'" frameborder="0" src="'+url+'" scrolling="yes" class="hs-iframe"></iframe>',
				id: id
			});
		}, change: function(id) {
			element.tabChange('WyTab', id);
		}
	};
	$('.admin-nav-item').click(function(event) {
		var that = $(this);
		event.stopPropagation();
		$(".layui-nav-tree").find("dd.layui-this").removeClass("layui-this");
		that.parent("dd").addClass("layui-this");
		
		if ($('iframe[id="tree_id_'+that.attr('data-id')+'"]')[0]) {
			tab.change(that.attr('data-id'));
			event.stopPropagation();
			return false;
		}else{
			that.css({color:'#fff'});
			tab.add(that.text(), that.attr('href'), that.attr('data-id'));
			tab.change(that.attr('data-id'));
			event.stopPropagation();
			return false;
		}
	});
	$(".layui-nav-item").click(function(){
		event.stopPropagation();
		var that = $(this);
		var data_id = that.find("a").attr("data-id")
		var data_url = that.find("a").attr("href")
		if(data_id == '121'){
			layer.confirm("确认是否退出登陆？", {title:false, closeBtn:0}, function(index){
				layer.msg('数据提交中...', {time:500000});
				$.get(data_url, {}, function(data) {
					if(data.code == 1){
						location.href = data.url;
					}else{
						layer.msg(data.msg, {time:500000});
					}
				});
			});
		}else{
			
		}
		
		
		
		return false;
	});
	$(document).on('click', '.layui-tab-close', function() {
		$('.layui-nav-child a[data-id="'+$(this).parent('li').attr('lay-id')+'"]').css({color:'rgba(255,255,255,.7)'});
	});
	$(document).on('click', '.layui-tab-title>li', function() {
		$(".layui-side-scroll").find("dd.layui-this").removeClass("layui-this");
		var lay_id = $(this).attr("lay-id");
		$(".layui-side-scroll").find(".admin-nav-item").each(function(){
			if($(this).attr("data-id") == lay_id){
				$(this).parent("dd").addClass("layui-this");
			}
		});
	});
});
</script>
</body>
</html>